﻿<%@ Page Title="Comment" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
    CodeFile="cmt.aspx.cs" Inherits="cmt" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="Server">
    <div class="title">
        Comment</div>
    <div class="des">
        Please, Let us know your opinion about this website and our products too. Thank
        you so much</div>
    <table style="width: 100%; height: 368px; margin-top: 20px;">
        <tr>
            <td class="cmtHead">
                Add Comment
            </td>
        </tr>
        <tr>
            <td>
                <asp:FormView ID="FormView1" runat="server" DataKeyNames="PosteID" DataSourceID="SqlDataSource1"
                    DefaultMode="Insert" EnableModelValidation="True" Height="311px" Width="689px">
                    <EditItemTemplate>
                        PosteID:
                        <asp:Label ID="PosteIDLabel1" runat="server" Text='<%# Eval("PosteID") %>' />
                        <br />
                        Title:
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        Name:
                        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Website:
                        <asp:TextBox ID="WebsiteTextBox" runat="server" Text='<%# Bind("Website") %>' />
                        <br />
                        Comment:
                        <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update" />
                        &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        Title:<br />
                        <asp:TextBox ID="TitleTextBox" runat="server" Height="23px" Text='<%# Bind("Title") %>'
                            Width="685px" />
                        <br />
                        Name:<br />
                        <asp:TextBox ID="NameTextBox" runat="server" Height="23px" Text='<%# Bind("Name") %>'
                            Width="685px" />
                        <br />
                        Website:<br />
                        <asp:TextBox ID="WebsiteTextBox" runat="server" Height="23px" Text='<%# Bind("Website") %>'
                            Width="685px" />
                        <br />
                        Comment:<br />
                        <asp:TextBox ID="CommentTextBox" runat="server" Height="127px" Text='<%# Bind("Comment") %>'
                            TextMode="MultiLine" Width="685px" />
                        <br />
                        <asp:Button ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                            Text="Insert" />
                        &nbsp;<asp:Button ID="InsertCancelButton" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        PosteID:
                        <asp:Label ID="PosteIDLabel" runat="server" Text='<%# Eval("PosteID") %>' />
                        <br />
                        Title:
                        <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        Name:
                        <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Email:
                        <asp:Label ID="WebsiteLabel" runat="server" Text='<%# Bind("Website") %>' />
                        <br />
                        Comment:
                        <asp:Label ID="CommentLabel" runat="server" Text='<%# Bind("Comment") %>' />
                        <br />
                        <asp:Button ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
                            Text="Edit" />
                        &nbsp;<asp:Button ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
                            Text="Delete" />
                        &nbsp;<asp:Button ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
                            Text="New" />
                    </ItemTemplate>
                </asp:FormView>
                <br />
            </td>
        </tr>
        <tr>
            <td class="cmtHead">
                View Comments
            </td>
        </tr>
        <tr>
            <td>
                <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConflictDetection="CompareAllValues"
                    ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
                    DeleteCommand="DELETE FROM [Postes] WHERE [PosteID] = @original_PosteID AND (([Title] = @original_Title) OR ([Title] IS NULL AND @original_Title IS NULL)) AND (([Name] = @original_Name) OR ([Name] IS NULL AND @original_Name IS NULL)) AND (([Website] = @original_Website) OR ([Website] IS NULL AND @original_Website IS NULL)) AND (([Comment] = @original_Comment) OR ([Comment] IS NULL AND @original_Comment IS NULL))"
                    InsertCommand="INSERT INTO [Postes] ([Title], [Name], [Website], [Comment]) VALUES (@Title, @Name, @Website, @Comment)"
                    OldValuesParameterFormatString="original_{0}" ProviderName="System.Data.SqlClient"
                    SelectCommand="SELECT * FROM [Postes]" UpdateCommand="UPDATE [Postes] SET [Title] = @Title, [Name] = @Name, [Website] = @Website, [Comment] = @Comment WHERE [PosteID] = @original_PosteID AND (([Title] = @original_Title) OR ([Title] IS NULL AND @original_Title IS NULL)) AND (([Name] = @original_Name) OR ([Name] IS NULL AND @original_Name IS NULL)) AND (([Website] = @original_Website) OR ([Website] IS NULL AND @original_Website IS NULL)) AND (([Comment] = @original_Comment) OR ([Comment] IS NULL AND @original_Comment IS NULL))">
                    <DeleteParameters>
                        <asp:Parameter Name="original_PosteID" Type="Int32" />
                        <asp:Parameter Name="original_Title" Type="String" />
                        <asp:Parameter Name="original_Name" Type="String" />
                        <asp:Parameter Name="original_Website" Type="String" />
                        <asp:Parameter Name="original_Comment" Type="String" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Website" Type="String" />
                        <asp:Parameter Name="Comment" Type="String" />
                    </InsertParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="Title" Type="String" />
                        <asp:Parameter Name="Name" Type="String" />
                        <asp:Parameter Name="Website" Type="String" />
                        <asp:Parameter Name="Comment" Type="String" />
                        <asp:Parameter Name="original_PosteID" Type="Int32" />
                        <asp:Parameter Name="original_Title" Type="String" />
                        <asp:Parameter Name="original_Name" Type="String" />
                        <asp:Parameter Name="original_Website" Type="String" />
                        <asp:Parameter Name="original_Comment" Type="String" />
                    </UpdateParameters>
                </asp:SqlDataSource>
                <br />
                <asp:FormView ID="FormView2" runat="server" AllowPaging="True" DataKeyNames="PosteID"
                    DataSourceID="SqlDataSource2" EnableModelValidation="True" Width="689px">
                    <EditItemTemplate>
                        PosteID:
                        <asp:Label ID="PosteIDLabel1" runat="server" Text='<%# Eval("PosteID") %>' />
                        <br />
                        Title:
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        Name:
                        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Website:
                        <asp:TextBox ID="WebsiteTextBox" runat="server" Text='<%# Bind("Website") %>' />
                        <br />
                        Comment:
                        <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
                        <br />
                        <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                            Text="Update" />
                        &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />
                    </EditItemTemplate>
                    <InsertItemTemplate>
                        Title:
                        <asp:TextBox ID="TitleTextBox" runat="server" Text='<%# Bind("Title") %>' />
                        <br />
                        Name:
                        <asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>' />
                        <br />
                        Website:
                        <asp:TextBox ID="WebsiteTextBox" runat="server" Text='<%# Bind("Website") %>' />
                        <br />
                        Comment:
                        <asp:TextBox ID="CommentTextBox" runat="server" Text='<%# Bind("Comment") %>' />
                        <br />
                        <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                            Text="Insert" />
                        &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                            CommandName="Cancel" Text="Cancel" />
                    </InsertItemTemplate>
                    <ItemTemplate>
                        PosteID:
                        <asp:Label ID="PosteIDLabel" runat="server" Text='<%# Eval("PosteID") %>' />
                        &nbsp;Title:
                        <asp:Label ID="TitleLabel" runat="server" Text='<%# Bind("Title") %>' />
                        &nbsp;Name:
                        <asp:Label ID="NameLabel" runat="server" Text='<%# Bind("Name") %>' />
                        &nbsp;Website:
                        <asp:Label ID="WebsiteLabel" runat="server" Text='<%# Bind("Website") %>' />
                        <hr style="height: 2px" />
                        Comment:
                        <asp:Label ID="CommentLabel" runat="server" Text='<%# Bind("Comment") %>' />
                        <br />
                    </ItemTemplate>
                </asp:FormView>
                <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True"
                    ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [Postes] ORDER BY [PosteID] DESC">
                </asp:SqlDataSource>
            </td>
        </tr>
    </table>

     
</asp:Content>
